Skip to content

migrate motia => bullmq - #247

Merged
MannuVilasara merged 3 commits into
mainfrom
mannu/bullmq
Nov 1, 2025
Merged

migrate motia => bullmq#247
MannuVilasara merged 3 commits into
mainfrom
mannu/bullmq

Conversation

@MannuVilasara

Copy link
Copy Markdown
Collaborator

No description provided.

@MannuVilasara
MannuVilasara requested a review from Copilot November 1, 2025 05:16
@MannuVilasara
MannuVilasara merged commit cb700be into main Nov 1, 2025
10 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the Motia event-driven service and replaces it with BullMQ for background job processing. The change simplifies the architecture by eliminating a separate microservice and consolidates all background job processing within the main backend using Redis-backed queues.

Key Changes:

  • Replaced Motia framework with BullMQ for async task processing
  • Removed Motia service container from Docker Compose
  • Implemented 4 BullMQ workers: page save, image upload, image cleanup, and task reminders
  • Added comprehensive documentation for the new BullMQ architecture

Reviewed Changes

Copilot reviewed 52 out of 55 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
package.json Removed Motia service from monorepo installation and startup scripts
docker-compose.yml Removed Motia service container and related dependencies
backend/package.json Added BullMQ dependency (v5.63.0)
backend/src/config/queue.js New BullMQ queue configuration with 4 queues (page-save, image-upload, image-cleanup, task-reminder)
backend/src/config/schedulers.js New scheduled jobs configuration for image cleanup (every 6 hours) and task reminders (every 5 minutes)
backend/src/workers/*.worker.js New BullMQ workers replacing Motia event handlers
backend/src/controllers/v2/page.controller.js Updated to use BullMQ queue instead of Motia HTTP calls
backend/server.js Integrated BullMQ initialization and graceful shutdown
docs/bullmq-jobs.md Comprehensive documentation for the new BullMQ architecture
motia/** Entire Motia service directory removed
.github/workflows/docker-build.yml Removed Motia Docker image build job
Files not reviewed (1)
  • backend/pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (2)

backend/server.js:1

  • Character encoding issue: the environment icon displays as '�' instead of '📍'. This appears to be a regression from the original emoji. Restore the correct emoji character.
/**

backend/server.js:1

  • Character encoding issue: the link icon displays as '�' instead of '🔗'. This appears to be a regression from the original emoji. Restore the correct emoji character.
/**

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +154 to +157
pageSaveQueue,
imageUploadQueue,
imageCleanupQueue,
taskReminderQueue,

Copilot AI Nov 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default export contains the initial null values of the queues, not the actual initialized queue instances. When importing from this module, consumers will receive null even after initializeQueues() is called. Remove the queue variables from the default export object or use a getter function to return current values.

Suggested change
pageSaveQueue,
imageUploadQueue,
imageCleanupQueue,
taskReminderQueue,
// Getter functions to always return the current queue instances
getPageSaveQueue: () => pageSaveQueue,
getImageUploadQueue: () => imageUploadQueue,
getImageCleanupQueue: () => imageCleanupQueue,
getTaskReminderQueue: () => taskReminderQueue,

Copilot uses AI. Check for mistakes.
Comment on lines +46 to +52

// Update page
page.pageData = newPageData;
await page.save();

// Handle image reference updates
const currentImageIds = getContentImageIds(newPageData);

Copilot AI Nov 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image ID extraction is performed twice on newPageData (lines 45 and 52). The previousImageIds should be extracted from page.pageData before the update, and currentImageIds from newPageData. Cache the currentImageIds result before updating the page to avoid redundant computation.

Suggested change
// Update page
page.pageData = newPageData;
await page.save();
// Handle image reference updates
const currentImageIds = getContentImageIds(newPageData);
const currentImageIds = getContentImageIds(newPageData);
// Update page
page.pageData = newPageData;
await page.save();
// Handle image reference updates

Copilot uses AI. Check for mistakes.
Comment on lines +3 to 4
// import motiaRoutes from './motia.routes.js';

Copilot AI Nov 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented-out import statement for motiaRoutes. Since the Motia service has been completely removed, this commented code should be deleted rather than left in place.

Suggested change
// import motiaRoutes from './motia.routes.js';

Copilot uses AI. Check for mistakes.
Comment on lines +9 to 10
// router.use('/motia', motiaRoutes);

Copilot AI Nov 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented-out route registration for motiaRoutes. Since the Motia service has been completely removed, this commented code should be deleted rather than left in place.

Suggested change
// router.use('/motia', motiaRoutes);

Copilot uses AI. Check for mistakes.
@MannuVilasara
MannuVilasara deleted the mannu/bullmq branch November 1, 2025 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants